.class public Lcom/jecelyin/editor/v2/ui/a;
.super Ljava/lang/Object;
.source "Document.java"

# interfaces
.implements Lcom/jecelyin/editor/v2/common/b;


# instance fields
.field private final a:Lcom/jecelyin/editor/v2/ui/b;

.field private final b:Landroid/content/Context;

.field private final c:Les/mf0;

.field private d:Ljava/lang/String;

.field private e:Ljava/io/File;

.field private f:Ljava/io/File;

.field private g:Z

.field private h:I


# direct methods
.method public constructor <init>(Landroid/content/Context;Lcom/jecelyin/editor/v2/ui/b;)V
    .locals 1

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const-string v0, "UTF-8"

    .line 2
    iput-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->d:Ljava/lang/String;

    .line 3
    iput-object p2, p0, Lcom/jecelyin/editor/v2/ui/a;->a:Lcom/jecelyin/editor/v2/ui/b;

    .line 4
    iput-object p1, p0, Lcom/jecelyin/editor/v2/ui/a;->b:Landroid/content/Context;

    const/4 v0, 0x0

    .line 5
    iput-boolean v0, p0, Lcom/jecelyin/editor/v2/ui/a;->g:Z

    .line 6
    new-instance v0, Les/mf0;

    invoke-direct {v0, p1, p2, p0}, Les/mf0;-><init>(Landroid/content/Context;Lcom/jecelyin/editor/v2/ui/b;Lcom/jecelyin/editor/v2/ui/a;)V

    iput-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->c:Les/mf0;

    return-void
.end method

.method static synthetic a(Lcom/jecelyin/editor/v2/ui/a;)Lcom/jecelyin/editor/v2/ui/b;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/jecelyin/editor/v2/ui/a;->a:Lcom/jecelyin/editor/v2/ui/b;

    return-object p0
.end method

.method private j()V
    .locals 5

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    invoke-virtual {v0}, Ljava/io/File;->canRead()Z

    move-result v0

    if-nez v0, :cond_0

    iget-boolean v0, p0, Lcom/jecelyin/editor/v2/ui/a;->g:Z

    if-nez v0, :cond_0

    .line 2
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->b:Landroid/content/Context;

    sget v1, Lcom/jecelyin/editor/v2/m;->je_cannt_read_file:I

    const/4 v2, 0x1

    new-array v2, v2, [Ljava/lang/Object;

    const/4 v3, 0x0

    iget-object v4, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    invoke-virtual {v4}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object v4

    aput-object v4, v2, v3

    invoke-virtual {v0, v1, v2}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/jecelyin/common/utils/e;->a(Landroid/content/Context;Ljava/lang/String;)V

    return-void

    .line 3
    :cond_0
    new-instance v0, Les/ef0;

    iget-boolean v1, p0, Lcom/jecelyin/editor/v2/ui/a;->g:Z

    if-eqz v1, :cond_1

    iget-object v1, p0, Lcom/jecelyin/editor/v2/ui/a;->f:Ljava/io/File;

    goto :goto_0

    :cond_1
    iget-object v1, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    :goto_0
    iget-object v2, p0, Lcom/jecelyin/editor/v2/ui/a;->d:Ljava/lang/String;

    iget-boolean v3, p0, Lcom/jecelyin/editor/v2/ui/a;->g:Z

    invoke-direct {v0, v1, v2, v3, p0}, Les/ef0;-><init>(Ljava/io/File;Ljava/lang/String;ZLcom/jecelyin/editor/v2/common/b;)V

    .line 4
    invoke-virtual {v0}, Les/ef0;->a()V

    return-void
.end method


# virtual methods
.method public a()Ljava/lang/String;
    .locals 1

    .line 29
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->d:Ljava/lang/String;

    return-object v0
.end method

.method public a(Lcom/jecelyin/editor/v2/ui/b$s;)V
    .locals 1

    .line 2
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->d:Ljava/lang/String;

    iput-object v0, p1, Lcom/jecelyin/editor/v2/ui/b$s;->d:Ljava/lang/String;

    .line 3
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    iput-object v0, p1, Lcom/jecelyin/editor/v2/ui/b$s;->b:Ljava/io/File;

    .line 4
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->f:Ljava/io/File;

    iput-object v0, p1, Lcom/jecelyin/editor/v2/ui/b$s;->g:Ljava/io/File;

    .line 5
    iget-boolean v0, p0, Lcom/jecelyin/editor/v2/ui/a;->g:Z

    iput-boolean v0, p1, Lcom/jecelyin/editor/v2/ui/b$s;->f:Z

    return-void
.end method

.method public a(Ljava/io/File;Ljava/lang/String;)V
    .locals 5

    const/4 v0, 0x0

    .line 6
    iput v0, p0, Lcom/jecelyin/editor/v2/ui/a;->h:I

    .line 7
    iput-object p2, p0, Lcom/jecelyin/editor/v2/ui/a;->d:Ljava/lang/String;

    .line 8
    iput-boolean v0, p0, Lcom/jecelyin/editor/v2/ui/a;->g:Z

    .line 9
    invoke-virtual {p1}, Ljava/io/File;->canRead()Z

    move-result p2

    const/4 v1, 0x1

    if-eqz p2, :cond_2

    invoke-virtual {p1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object p2

    invoke-static {p2}, Lcom/jecelyin/editor/v2/b;->b(Ljava/lang/String;)Z

    move-result p2

    if-eqz p2, :cond_0

    goto :goto_0

    .line 10
    :cond_0
    invoke-virtual {p1}, Ljava/io/File;->isFile()Z

    move-result p2

    if-eqz p2, :cond_1

    invoke-virtual {p1}, Ljava/io/File;->exists()Z

    move-result p2

    if-nez p2, :cond_4

    .line 11
    :cond_1
    iget-object p2, p0, Lcom/jecelyin/editor/v2/ui/a;->b:Landroid/content/Context;

    sget v2, Lcom/jecelyin/editor/v2/m;->je_cannt_access_file:I

    new-array v1, v1, [Ljava/lang/Object;

    invoke-virtual {p1}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object p1

    aput-object p1, v1, v0

    invoke-virtual {p2, v2, v1}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

    invoke-static {p2, p1}, Lcom/jecelyin/common/utils/e;->a(Landroid/content/Context;Ljava/lang/String;)V

    return-void

    .line 12
    :cond_2
    :goto_0
    new-instance p2, Ljava/io/File;

    invoke-static {}, Lcom/jecelyin/editor/v2/b;->b()Ljava/lang/String;

    move-result-object v2

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {p1}, Ljava/io/File;->getName()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v4, ".bak"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {p2, v2, v3}, Ljava/io/File;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    iput-object p2, p0, Lcom/jecelyin/editor/v2/ui/a;->f:Ljava/io/File;

    .line 13
    invoke-virtual {p2}, Ljava/io/File;->exists()Z

    move-result p2

    if-eqz p2, :cond_3

    .line 14
    iget-object p2, p0, Lcom/jecelyin/editor/v2/ui/a;->f:Ljava/io/File;

    invoke-virtual {p2}, Ljava/io/File;->delete()Z

    .line 15
    :cond_3
    invoke-virtual {p1}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object p2

    iget-object v2, p0, Lcom/jecelyin/editor/v2/ui/a;->f:Ljava/io/File;

    invoke-virtual {v2}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object v2

    invoke-static {p2, v2}, Lcom/jecelyin/editor/v2/b;->b(Ljava/lang/String;Ljava/lang/String;)Z

    move-result p2

    iput-boolean p2, p0, Lcom/jecelyin/editor/v2/ui/a;->g:Z

    .line 16
    :cond_4
    invoke-virtual {p1}, Ljava/io/File;->canRead()Z

    move-result p2

    if-nez p2, :cond_5

    iget-boolean p2, p0, Lcom/jecelyin/editor/v2/ui/a;->g:Z

    if-nez p2, :cond_5

    .line 17
    iget-object p2, p0, Lcom/jecelyin/editor/v2/ui/a;->b:Landroid/content/Context;

    sget v2, Lcom/jecelyin/editor/v2/m;->je_cannt_read_file:I

    new-array v1, v1, [Ljava/lang/Object;

    invoke-virtual {p1}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object p1

    aput-object p1, v1, v0

    invoke-virtual {p2, v2, v1}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

    invoke-static {p2, p1}, Lcom/jecelyin/common/utils/e;->a(Landroid/content/Context;Ljava/lang/String;)V

    return-void

    .line 18
    :cond_5
    iput-object p1, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    .line 19
    invoke-direct {p0}, Lcom/jecelyin/editor/v2/ui/a;->j()V

    return-void
.end method

.method a(Ljava/io/File;Ljava/lang/String;Lcom/jecelyin/editor/v2/common/c;)V
    .locals 1

    .line 36
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->c:Les/mf0;

    invoke-virtual {v0, p1, p2, p3}, Les/mf0;->a(Ljava/io/File;Ljava/lang/String;Lcom/jecelyin/editor/v2/common/c;)V

    return-void
.end method

.method public a(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/Throwable;I)V
    .locals 2

    .line 20
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->a:Lcom/jecelyin/editor/v2/ui/b;

    if-eqz v0, :cond_3

    iget-object v1, v0, Lcom/jecelyin/editor/v2/ui/b;->b:Lcom/jecelyin/editor/v2/widget/text/EditAreaView;

    if-nez v1, :cond_0

    goto :goto_1

    .line 21
    :cond_0
    iput-object p2, p0, Lcom/jecelyin/editor/v2/ui/a;->d:Ljava/lang/String;

    .line 22
    iput p4, p0, Lcom/jecelyin/editor/v2/ui/a;->h:I

    if-eqz p3, :cond_2

    .line 23
    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/ui/b;->l()V

    .line 24
    instance-of p1, p3, Ljava/lang/OutOfMemoryError;

    if-eqz p1, :cond_1

    .line 25
    iget-object p1, p0, Lcom/jecelyin/editor/v2/ui/a;->b:Landroid/content/Context;

    sget p2, Lcom/jecelyin/editor/v2/m;->je_out_of_memory_error:I

    invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object p1

    goto :goto_0

    .line 26
    :cond_1
    iget-object p1, p0, Lcom/jecelyin/editor/v2/ui/a;->b:Landroid/content/Context;

    sget p2, Lcom/jecelyin/editor/v2/m;->je_read_file_exception:I

    invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object p1

    .line 27
    :goto_0
    iget-object p2, p0, Lcom/jecelyin/editor/v2/ui/a;->b:Landroid/content/Context;

    invoke-static {p2, p1}, Lcom/jecelyin/common/utils/e;->a(Landroid/content/Context;Ljava/lang/String;)V

    return-void

    .line 28
    :cond_2
    iget-object p2, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    invoke-virtual {p2}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object p2

    new-instance p3, Lcom/jecelyin/editor/v2/ui/a$a;

    invoke-direct {p3, p0}, Lcom/jecelyin/editor/v2/ui/a$a;-><init>(Lcom/jecelyin/editor/v2/ui/a;)V

    invoke-virtual {v1, p2, p1, p3}, Lcom/jecelyin/editor/v2/widget/text/EditAreaView;->a(Ljava/lang/String;Ljava/lang/CharSequence;Lcom/jecelyin/editor/v2/widget/text/c;)V

    :cond_3
    :goto_1
    return-void
.end method

.method public a(ZLcom/jecelyin/editor/v2/common/c;)V
    .locals 1

    .line 30
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->c:Les/mf0;

    invoke-virtual {v0}, Les/mf0;->a()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 31
    iget-object p1, p0, Lcom/jecelyin/editor/v2/ui/a;->b:Landroid/content/Context;

    sget p2, Lcom/jecelyin/editor/v2/m;->je_writing:I

    invoke-static {p1, p2}, Lcom/jecelyin/common/utils/e;->b(Landroid/content/Context;I)V

    return-void

    :cond_0
    if-eqz p1, :cond_1

    .line 32
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    if-nez v0, :cond_1

    .line 33
    invoke-interface {p2}, Lcom/jecelyin/editor/v2/common/c;->a()V

    .line 34
    iget-object p1, p0, Lcom/jecelyin/editor/v2/ui/a;->b:Landroid/content/Context;

    sget p2, Lcom/jecelyin/editor/v2/m;->je_save_all_without_new_document_message:I

    invoke-static {p1, p2}, Lcom/jecelyin/common/utils/e;->b(Landroid/content/Context;I)V

    return-void

    .line 35
    :cond_1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->c:Les/mf0;

    invoke-virtual {v0, p1, p2}, Les/mf0;->a(ZLcom/jecelyin/editor/v2/common/c;)V

    return-void
.end method

.method public b()Ljava/io/File;
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    return-object v0
.end method

.method public b(Ljava/io/File;Ljava/lang/String;)V
    .locals 2

    if-eqz p1, :cond_0

    .line 2
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    if-eqz v0, :cond_0

    .line 3
    invoke-virtual {p1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    invoke-virtual {v1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/text/TextUtils;->equals(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_0

    .line 4
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->a:Lcom/jecelyin/editor/v2/ui/b;

    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/ui/b;->d()Lcom/jecelyin/editor/v2/ui/JeEditorActivity;

    move-result-object v0

    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/ui/JeEditorActivity;->A()Lcom/jecelyin/editor/v2/ui/g;

    move-result-object v0

    invoke-virtual {v0, p1, p2}, Lcom/jecelyin/editor/v2/ui/g;->a(Ljava/io/File;Ljava/lang/String;)Z

    return-void

    .line 5
    :cond_0
    iput-object p1, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    .line 6
    iput-object p2, p0, Lcom/jecelyin/editor/v2/ui/a;->d:Ljava/lang/String;

    .line 7
    iget-object p1, p0, Lcom/jecelyin/editor/v2/ui/a;->a:Lcom/jecelyin/editor/v2/ui/b;

    invoke-virtual {p1}, Lcom/jecelyin/editor/v2/ui/b;->o()V

    .line 8
    iget-object p1, p0, Lcom/jecelyin/editor/v2/ui/a;->a:Lcom/jecelyin/editor/v2/ui/b;

    invoke-virtual {p1}, Lcom/jecelyin/editor/v2/ui/b;->k()V

    return-void
.end method

.method public c()I
    .locals 1

    .line 1
    iget v0, p0, Lcom/jecelyin/editor/v2/ui/a;->h:I

    return v0
.end method

.method public d()Ljava/lang/String;
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->e:Ljava/io/File;

    if-nez v0, :cond_0

    const/4 v0, 0x0

    goto :goto_0

    :cond_0
    invoke-virtual {v0}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object v0

    :goto_0
    return-object v0
.end method

.method public e()Ljava/io/File;
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->f:Ljava/io/File;

    return-object v0
.end method

.method public f()Z
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->a:Lcom/jecelyin/editor/v2/ui/b;

    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/ui/b;->j()Z

    move-result v0

    return v0
.end method

.method public g()Z
    .locals 1

    .line 1
    iget-boolean v0, p0, Lcom/jecelyin/editor/v2/ui/a;->g:Z

    return v0
.end method

.method public h()V
    .locals 2

    const/4 v0, 0x0

    const/4 v1, 0x0

    .line 1
    invoke-virtual {p0, v0, v1}, Lcom/jecelyin/editor/v2/ui/a;->a(ZLcom/jecelyin/editor/v2/common/c;)V

    return-void
.end method

.method public i()V
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->a:Lcom/jecelyin/editor/v2/ui/b;

    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/ui/b;->q()V

    return-void
.end method

.method public onStart()V
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/ui/a;->a:Lcom/jecelyin/editor/v2/ui/b;

    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/ui/b;->m()V

    return-void
.end method
